package com.dtsheep.rxjava.stduy.observable;

import rx.Observable;

/**
 * ConcatDemo
 *
 * <p>
 *     类似于 flatMap，但保持顺序
 * </p>
 *
 * @author chuanbai
 * @date 2024/5/18
 */
public class ConcatDemo {

    public void concat01(){
        Observable<String> observable01 = Observable.just("1");
        Observable<String> observable02 = Observable.just("2");

        // 连接两个 Observable 对象 保持顺序
        Observable<String> observableConcat = Observable.concat(observable01, observable02);

        observableConcat.subscribe(obj-> System.out.println(obj));

    }

    public static void main(String[] args) {
        ConcatDemo concatDemo = new ConcatDemo();
        concatDemo.concat01();
    }
}
